package com.example.administrator.smartdevice.utils;

import android.graphics.Color;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.widget.TextView;

import java.util.regex.Pattern;

public class StringUtils {

    public static boolean isBlank(String string) {
        return null == string || "".equals(string.trim());
    }

    /**
     * 包括空格判断
     *
     * @param input
     * @return
     */
    public static boolean containSpace(CharSequence input) {
        return Pattern.compile("\\s+").matcher(input).find();
    }

    public static String getSceneType(String applianceType) {
        if (applianceType.equals("房间")) {
            return "10";
        } else if (applianceType.equals("厨房")) {
            return "20";
        } else if (applianceType.equals("大厅")) {
            return "30";
        } else if (applianceType.equals("卫生间")) {
            return "40";
        } else if (applianceType.equals("卫生间")) {
            return "50";
        }
        return "";
    }

    public static String getApplianceType(String applianceType) {
        if (applianceType.equals("001")) {
            return "灯";
        } else if (applianceType.equals("002")) {
            return "门锁";
        } else if (applianceType.equals("003")) {
            return "窗帘";
        } else if (applianceType.equals("004")) {
            return "电视机";
        } else if (applianceType.equals("005")) {
            return "空调";
        }
        return "未知";
    }
}
